﻿using UnityEngine;
using System.Collections;

[USequencerEvent("附加/附加到父节点")]
public class USAttachToParentEvent : USEventBase {
	public Transform parentObject = null;
	
	private Transform originalParent = null;
	
	public override void FireEvent()
	{
		if(!parentObject)
		{
			Debug.Log("参数缺少父对象");
			return;
		}
		
		originalParent = AffectedObject.transform.parent;
		AffectedObject.transform.parent = parentObject;
	}

	public override void ProcessEvent(float deltaTime)
	{
		
	}
	
	public override void StopEvent()
	{
		UndoEvent();
	}
	
	public override void UndoEvent()
	{
		AffectedObject.transform.parent = originalParent;
	}
}
